#pragma once
#include "data_structure.h"
//// 更新日期
//void update(int* year, int* mon, int* mday);
// 时间链表初始化
void initTList(TList* t_list);
// 场地时间链表设置
void set_TList(System* sys);
// 创建场地
Facility create_facility(System system, int id, char* name, int manager_id, int type, int area, char* open_time, float price,int max_person_num);

// 初始化场地链表
void init_FList(FList* list);

// 创建场地节点
FNode* create_FNode(Facility* facility);

// 添加场地到链表
void add_facility(FList* list, Facility* facility);

// 删除场地节点
int delete_facility(FList* list, int facility_id);

// 查找场地节点
Facility* find_facility(FList* list, int facility_id);

// 打印链表中的所有场地
void print_facilities(FList* list);


// 清空链表
void clear_facility(FList* list);

// 打印场地类型
void print_facility_type(VenueType type);

// 根据类型打印场地
void print_facility_by_type(VenueType type, FList* list);

// 打印人流量
bool print_time_list(Facility facility, int year, int month, int day);

// 判断 某个场地某个时间是否有空
bool judge_facility_free(Facility* facility,int year,int month,int day,char* start_time,char* end_time);

// 场地某个时间段 人数+1
void add_facility_people(Facility* facility, int year, int month, int day, char* start_time, char* end_time);

//根据id打印场地
void print_facility_by_type(VenueType type, FList* list);

//排序功能
// 查看场地 Order by 编号
void sort_facility_order_by_id(FList* list);
// 查看场地 Order by 面积
void sort_facility_order_by_area(FList* list);
// 查看场地 Order by 费用
void sort_facility_order_by_fee(FList* list);
// 查看场地 Order by 类型
void sort_facility_order_by_type(FList* list);


//场地查找
void query_facility_by_type(System sys);

void query_facility_with_type(FList* list, const char* type);

void query_facility_by_max_person(System sys);

void query_facility_with_max_person(FList* list, int max_person);

void query_facility_by_id(System sys);

void fuzzy_search_facility(System sys);

void query_facility_with_keyword(FList* list, const char* keyword);

void query_facility_by_area(System sys);

void query_facility_with_area(FList* list, int area);

void query_facility_by_price(System sys);

void query_facility_with_price(FList* list, float min_price, float max_price);

void query_facility_by_type_price(System sys);

void query_facility_with_type_price(FList* list, const char* type, float min_price, float max_price);

void query_facility_by_type_area(System sys);

void query_facility_with_type_area(FList* list, const char* type, int area);

// 打印场地信息
void print_facility(FNode* f_node);
// 统计功能
// 统计场地 根据类型
void statistic_facility_by_type(System sys);
// 统计场地 根据价格
void statistic_facility_by_price(System sys);
// 统计场地 根据面积
void statistic_facility_by_area(System sys);
// 统计场地 根据类型 + 价格
void statistic_facility_by_type_price(System sys);
// 统计场地 根据类型 + 面积
void statistic_facility_by_type_area(System sys);
// 统计场地 根据面积范围
void statistic_facility_by_area_range(System sys);
// 统计场地 根据价格范围
void statistic_facility_by_price_range(System sys);